package edu.jsnu.operate.controller.ticket.common;

//import constants.RCodeEnums;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

@Controller
@RequestMapping("/error")
public class ErrorController extends AbstractController{

	@RequestMapping("/error.page")
	public String pageError(Model model, @RequestParam(value = "errorCode",defaultValue = "3302") String errorCode) {
//		String eCode = RCodeEnums.valueOf("E"+errorCode).getCode();
//		String eMsg = RCodeEnums.valueOf("E" + errorCode).getMsg();
//		model.addAttribute("errorCode", eCode);
//		model.addAttribute("errorMsg", eMsg);
//		log.info("errorInfo:"+eCode+eMsg);
		return "error/error";
	}

	@RequestMapping("/403.page")
	public String page403(Model model, @PathVariable("errorCode") String errorCode) {
		model.addAttribute("errorCode", errorCode);
		model.addAttribute("errorMsg", "error");
		return "error/403" ;
	}

	@RequestMapping("/404.page")
	public String page404(Model model) {
		return "error/404" ;
	}
	@RequestMapping("/500.page")
	public String page500(Model model, @PathVariable("errorCode") String errorCode) {
		model.addAttribute("errorCode", errorCode);
		model.addAttribute("errorMsg", "error");
		return "error/500" ;
	}
}